<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .box-wrapper {
      width: 800px;
      height: 200px;
      margin-bottom: 100px;
    }
    .box {
      float: left;
      width: 200px;
      line-height: 200px;
      color: #fff;
      text-align: center;
      font-size: 34px;
    }
    .box1 {
      background-color: blue;
    }
    .box2 {
      background-color: yellow;
    }
    .box3 {
      background-color: red;
    }
    .box4 {
      background-color: green;
    }

  </style>
</head>
<body>
  <div id="app">
    <div class="box-wrapper">
      <div class="box box1" v-if="boxShow1">BOX 1</div>
      <div class="box box2" v-show="boxShow2">BOX 2</div>
      <div class="box box3" v-if="boxShow3">BOX 3</div>
      <div class="box box4" v-show="boxShow4">BOX 4</div>
    </div>
    <div class="btn-warpper">
      <button @click="showBox1">BOX 1</button>
      <button @click="showBox2">BOX 2</button>
      <button @click="showBox3">BOX 3</button>
      <button @click="showBox4">BOX 4</button>
    </div>
  </div>
  
  <script src="./index.js"></script>
  <script>
    new Vue({
      el: '#app',
      data() {
        return {
          boxShow1: false,
          boxShow2: false,
          boxShow3: false,
          boxShow4: false
        }
      },
      methods: {
        showBox1() {
          this.boxShow1 = !this.boxShow1;
        },
        showBox2() {
          this.boxShow2 = !this.boxShow2;
        },
        showBox3() {
          this.boxShow3 = !this.boxShow3;
        },
        showBox4() {
          this.boxShow4 = !this.boxShow4;
        }
      }
    })

  </script>
</body>
</html>